import pymysql

conn = pymysql.connect("localhost","root","0525","student_inf" )
 

cursor = conn.cursor()
# 写sql语句
sql = "select 学生姓名 from 软件1801;"
# 执行sql语句
ret=cursor.execute(sql)
print('-->',ret)

# 一次取所有
print(cursor.fetchall())

 
# 关闭数据库连接
conn.close()